<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<style>
    * {
        margin: 0;
        padding: 0;
    }

    img {
        width: 520px;
        /* width: 100%; */
        height: 280px;
    }

    ul,
    li {
        list-style: none;
    }

    ul {
        width: 640px;
        height: 280px;
        margin: 30px auto;
        border: 10px solid pink;
        overflow: hidden;
    }

    li {
        width: 160px;
        height: 100%;
        overflow: hidden;
        position: relative;
        float: left;
    }
</style>
</head>

<body>
    <ul>
        <li><img src="./img/01.jpg" alt=""></li>
        <li><img src="./img/02.jpg" alt=""></li>
        <li><img src="./img/03.jpg" alt=""></li>
        <li><img src="./img/04.jpg" alt=""></li>
    </ul>
</body>
<script src="../jquery/jquery.min.js"></script>
<script>
    //通过控制li标签的宽度来实现手风琴的效果
    //160*4 => 520*1+40*3
    $("ul").on("mouseenter", "li", function () {
        $(this).stop().animate({ width: "520px" }).siblings().stop().animate({ width: "40px" })
    })
    $("ul").mouseleave(function () {
        $(this).children().stop().animate({ width: "160px" })
    })

</script>

</html>